#!/usr/bin/env python

import wx

class Manga(wx.ComboBox):
    '''Manga Class
    
    @author Julot <andy.julot@gmail.com>
    @since Tuesday, May 08, 2012. 06:36 PM'''
    
    def __init__(self, parent):
        wx.ComboBox.__init__(self, parent, style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, self._onComboBox)
    
    _values = None
    
    @property
    def values(self):
        return self._values
    
    @values.setter
    def values(self, values):
        self._values = values
        self._value = None
        self.Clear()
        for value in values:
            self.Append(value['title'])
    
    _value = None
    
    @property
    def value(self):
        return self._value
    
    def _onComboBox(self, event):
        self._value = self._values[event.Selection]
        event.Skip()